package com.wf.day_0614.test1;

/**
 * @author mpk
 * @since 2024/6/14 17:59:11
 */
public class Demo {

    static Singleton instance1;
    static Singleton instance2;
    static Singleton instance3;

    public static void main(String[] args) throws InterruptedException {


        new Thread(() ->
        {
            instance1 = Singleton.getInstance();
            System.out.println(instance1);

        }).start();


        new Thread(() ->
        {
            instance2 = Singleton.getInstance();

            System.out.println(instance2);
        }).start();
        new Thread(() ->
        {
            instance3 = Singleton.getInstance();
            System.out.println(instance3);

        }).start();


        Thread.sleep(100);



        System.out.println(instance1 == instance2);
        System.out.println(instance3 == instance2);
        System.out.println(instance1 == instance3);


    }


}
